<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace api\wxapp\controller;

use cmf\controller\RestBaseController;
use wxapp\aes\WXBizDataCrypt;
use app\common\model\RlZsmsUserQueryModel;
class SalesaddressbookController extends RestBaseController
{
        protected function initialize()
    {
        $this->RlZsmsUserQueryModel = new RlZsmsUserQueryModel;
    }
    // 获取销售联系人信息
    public function index()
    {
    	$sms_user = $this->sms_user;
    	//获取同一个经销商下的人员
    	$smsUserList = $this->RlZsmsUserQueryModel->where('ignore',0)->where(['JXS_CODE'=>$sms_user['JXS_CODE']])->select();
    	//取出专业店名称
    	$ZYD_MC = array_column($smsUserList,'ZYD_MC');
    	//去除重复的名字
    	$ZYD_MC = array_unique($ZYD_MC);
    	//根据专业店名字进行分组
    	$list = [];
    	foreach ($ZYD_MC as $key => $value) {
    		foreach ($smsUserList as $k => $v) {
    			if($value == $v['ZYD_MC'])
    			$list[$key][] = $v;
	    	}
    	}
    	$this->success("获取成功!", [ 'list' => $list]);
    }

}
